<?php
include_once "config/db.php" ;
class QinDb
{
  private $db;
  public function __construct()
  {
    try 
      {
	$params = array('host'     => DB_HOST,
			'username' => DB_USERNAME,
			'password' => DB_PASSWD,
			'dbname'   => DB_NAME);

	$this->db = Zend_Db::factory('pdo_mysql', $params);
	$this->db->getConnection();
	//$this->db->exec('set names utf8;');
	//$this->db->exec('set names latin1;');
      }
    catch (Zend_Db_Adapter_Exception $e)
      {
	print $e->getMessage();
      }
  }	
  static public function instance()
  {
    $params = array('host'     => DB_HOST,
		    'username' => DB_USERNAME,
		    'password' => DB_PASSWD,
		    'dbname'   => DB_NAME);

    $db = Zend_Db::factory('pdo_mysql', $params);
    $db->getConnection();

    return $db;
  }
};
